package com.sjd.farm.mapper;

import com.sjd.farm.domain.SjdFarmGoodsDO;
import com.sjd.farm.domain.dto.goods.SjdAppFarmGoodsQueryResponseDTO;
import com.sjd.farm.domain.dto.goods.SjdWebSiteFarmGoodsQueryResponseDTO;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author s
 */
public interface SjdFarmGoodsMapper {
    /**
     * 删除
     *
     * @param goodsId goodsId
     * @return return
     */
    int logicDelete(Long goodsId);

    /**
     * insert
     *
     * @param record record
     * @return return
     */
    int insert(SjdFarmGoodsDO record);

    /**
     * insertSelective
     *
     * @param record record
     * @return return
     */
    int insertSelective(SjdFarmGoodsDO record);

    /**
     * selectByPrimaryKey
     *
     * @param goodsId goodsId
     * @return return
     */
    SjdFarmGoodsDO selectByPrimaryKey(Long goodsId);

    /**
     * updateByPrimaryKeySelective
     *
     * @param record record
     * @return return
     */
    int updateByPrimaryKeySelective(SjdFarmGoodsDO record);

    /**
     * updateByPrimaryKey
     *
     * @param record record
     * @return return
     */
    int updateByPrimaryKey(SjdFarmGoodsDO record);

    /**
     * 更新库存数量
     *
     * @param goodsId   goodsId
     * @param changeNum 库存变化变化数
     * @return return
     */
    int updateStorage(@Param("goodsId") Long goodsId, @Param("changeNum") BigDecimal changeNum);


    /**
     * 管理平台查询农场商品
     *
     * @param goodsId        goodsId
     * @param goodsName      goodsName
     * @param goodsTypeClass goodsTypeClass
     * @param isOnline       isOnline
     * @param goodsLevel     goodsLevel
     * @return return
     */
    List<SjdWebSiteFarmGoodsQueryResponseDTO> webSiteQueryFarmGoods(@Param("goodsId") Long goodsId,
                                                                    @Param("goodsName") String goodsName,
                                                                    @Param("goodsTypeClass") Integer goodsTypeClass,
                                                                    @Param("isOnline") Boolean isOnline,
                                                                    @Param("goodsLevel") Integer goodsLevel
    );

    /**
     * 小程序查询农场商品
     *
     * @param goodsId        goodsId
     * @param goodsTypeClass goodsTypeClass
     * @param farmLevel      farmLevel
     * @return return
     */
    List<SjdAppFarmGoodsQueryResponseDTO> appQueryFarmGoods(@Param("goodsId") Long goodsId,
                                                            @Param("goodsTypeClass") Integer goodsTypeClass,
                                                            @Param("farmLevel") Integer farmLevel
    );
}